import { Button, Space } from 'ant-design-vue';
import {
  DeleteOutlined,
  UploadOutlined,
  ArrowDownOutlined,
  FilterOutlined
} from '@ant-design/icons-vue';
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'VxeTableToolButtons',
  props: {
    createCall: {
      type: Function,
      default: () => {}
    },
    deleteCall: {
      type: Function,
      default: () => {}
    },
    filterCall: {
      type: Function,
      default: () => {}
    },
    showDelete: {
      type: Boolean,
      default: true
    },
    showImport: {
      type: Boolean,
      default: true
    },
    showExport: {
      type: Boolean,
      default: true
    },
    showFilter: {
      type: Boolean,
      default: true
    }
  },
  setup() {
    const paddingLeft = 'padding-left:5px';
    return {
      paddingLeft
    };
  },
  render() {
    return (
      <>
        <Space size={2} style={this.paddingLeft}>
          <Button
            type="primary"
            v-permission="sysExlog:clear"
            onClick={() => {
              this.createCall();
            }}
          >
            清空日志
          </Button>
          <Button
            v-show={this.showDelete}
            type="primary"
            onClick={() => {
              this.deleteCall;
            }}
            v-permission={'sysPos:delete'}
          >
            <DeleteOutlined />
            批量
          </Button>
          <Button
            v-show={this.showImport}
            type="primary"
            v-permission={'sysPos:import'}
          >
            <UploadOutlined /> 导入
          </Button>
          <Button
            v-show={this.showExport}
            type="primary"
            v-permission={'sysPos:export'}
          >
            <ArrowDownOutlined />
            导出
          </Button>
          <Button
            v-show={this.showFilter}
            type="primary"
            onClick={() => {
              this.filterCall();
            }}
          >
            <FilterOutlined />
            过滤
          </Button>
        </Space>
      </>
    );
  }
});
